package bom.controller.organization;

import bom.service.i.organization.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @Author: Fancyears·Maylos·Malvis
 * @Description: 字典操作
 * @Date: Created in  2018/11/27 16:00
 * @Modified By:
 */
@Controller
@RequestMapping("/dict")
public class DictController {
    @Autowired
    private DictService dictService;

    /**
     * 功能描述：将字典数据初始化到前端js中
     *
     * @return
     */
    @RequestMapping(value = "/loadDict", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public Map<String, Object> loadDict() {
        return dictService.loadDict();
    }

    /**
     * 功能描述：重新加载数据字典的数据到内存中
     *
     * @return
     */
    @RequestMapping(value = "/reload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public Map<String, Object> reload() {
        return dictService.reload();
    }
}
